<?php
!defined('P_W') && exit('Forbidden');

class PW_PageCacheConfigPrice {
	var $price;
	var $hid;

	function __construct($price,$hid=0) {
		$this->price = $this->_initPirce($price);
		$this->hid = (int) $hid;
	}
	function PW_PageCacheConfigInfo($price,$hid=0) {
		$this->__construct($price);
	}
	
	function getConfig() {
		return $this->_pageConfig();
	}
	
	function _initPirce($price) {
		global $house_field;
		if (!$house_field['aveprice']) return 0; 
		foreach ($house_field['aveprice'] as $key=>$value) {
			if ($price>$value['start'] && $price<$value['end']) {
				return $key;
			}
		}
	}
	
	function _pageConfig() {
		$cache_config = array(
			'newHouseByPrice' => array('type'=>'housesort','sorttype'=>'price','round'=>$this->price,'cachetime'=>9999,'num'=>'10','hid'=>$this->hid),
			'recommendHouse' => array('type'=>'housesort','sorttype'=>'recommend','num'=>'8'),
		);
		return $cache_config;
	}
}
?>